package com.xishu.entity.customer;

import com.xishu.annotation.dao.CustomerNotModify;
import com.xishu.annotation.dao.DefaultValue;
import com.xishu.annotation.dao.FieldMapping;
import com.xishu.bo.TicketAndLimit;
import com.xishu.entity.AbstractEntity;
import com.xishu.entity.shop.DiscountTicket;
import io.swagger.annotations.ApiModelProperty;

import javax.persistence.*;
import java.util.List;

@Entity(name = "market_birthday_template")
@Table(indexes = {@Index(columnList = "companyId")})
public class MarketBirthdayTemplate extends AbstractEntity {
    @ApiModelProperty(value = "归属哪一个公司")
    private Long companyId;

    @ApiModelProperty(value = "标题")
    private String title;

    @ApiModelProperty(value = "内容")
    @Lob
    @Column(columnDefinition = "MEDIUMTEXT")
    private String content;

    @ApiModelProperty(value = "提醒时间，提前多少天提醒")
    private Integer remindTime;

    @ApiModelProperty(value = "小时")
    private Integer hour;

    @Transient
    @ApiModelProperty(value = "优惠卷的ID列表")
    @FieldMapping(desField = "ticketJson", serialize = true)
    private List<Long> ticketIdList;

    @ApiModelProperty(value = "优惠卷的ID列表")
    @FieldMapping(desField = "ticketIdList", serialize = false, genericType = "java.lang.Long")
    private String ticketJson;

    @ApiModelProperty(value = "是否开启")
    @DefaultValue(defaultValue = "false")
    public Boolean enable;

    @ApiModelProperty(value = "使用了哪些优惠券")
    @Transient
    @FieldMapping(desField = "ticketListJson", serialize = true, genericType = "com.xishu.bo.TicketAndLimit")
    @CustomerNotModify
    @DefaultValue(defaultValue = "")
    private List<TicketAndLimit> ticketAndLimitList;

    @ApiModelProperty(value = "使用了哪些优惠券")
    @FieldMapping(desField = "ticketAndLimitList", serialize = false, genericType = "com.xishu.bo.TicketAndLimit")
    @CustomerNotModify
    @Lob
    @Column(columnDefinition = "MEDIUMTEXT")
    private String ticketListJson;

    @Transient
    @ApiModelProperty(value = "优惠券对象列表")
    @CustomerNotModify
    private List<DiscountTicket> ticketList;

    public List<DiscountTicket> getTicketList() {
        return ticketList;
    }

    public void setTicketList(List<DiscountTicket> ticketList) {
        this.ticketList = ticketList;
    }

    public List<TicketAndLimit> getTicketAndLimitList() {
        return ticketAndLimitList;
    }

    public void setTicketAndLimitList(List<TicketAndLimit> ticketAndLimitList) {
        this.ticketAndLimitList = ticketAndLimitList;
    }

    public String getTicketListJson() {
        return ticketListJson;
    }

    public void setTicketListJson(String ticketListJson) {
        this.ticketListJson = ticketListJson;
    }

    public Boolean getEnable() {
        return enable;
    }

    public void setEnable(Boolean enable) {
        this.enable = enable;
    }

    public Integer getHour() {
        return hour;
    }

    public void setHour(Integer hour) {
        this.hour = hour;
    }

    public Long getCompanyId() {
        return companyId;
    }

    public void setCompanyId(Long companyId) {
        this.companyId = companyId;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public Integer getRemindTime() {
        return remindTime;
    }

    public void setRemindTime(Integer remindTime) {
        this.remindTime = remindTime;
    }

    public List<Long> getTicketIdList() {
        return ticketIdList;
    }

    public void setTicketIdList(List<Long> ticketIdList) {
        this.ticketIdList = ticketIdList;
    }

    public String getTicketJson() {
        return ticketJson;
    }

    public void setTicketJson(String ticketJson) {
        this.ticketJson = ticketJson;
    }
}
